package org.mii.safeguard.v1.security.entity;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.mii.safeguard.v1.entity.IdEntity;

/**
 * 权限.
 * 
 * @author calvin
 */
@Entity
@Table(name = "AUTHORITIES")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Authority extends IdEntity  implements AuthorityIdentifier{

	private String name;
	private String displayName;

	//Transient JUST A IDENTIFIER
	private String isAuth = "false";
	private String isNotAuth = "true";

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDisplayName() {
		return displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	@Transient
	public String getIsNotAuth() {
		return isNotAuth;
	}

	@Transient
	public String getIsAuth() {
		return isAuth;
	}

	public void setIsAuth(String isAuth) {
		this.isAuth = isAuth;
		this.isNotAuth = String.valueOf(!Boolean.valueOf(isAuth));
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
